(function(app) {
    app
        .controller("content_39_inputCtrl", ["$scope", "myFactory", '$http', '$stateParams', '$state', "$q", '$timeout', '$location', '$ionicHistory', function($scope, myFactory, $http, $stateParams, $state, $q, $timeout, $location, $ionicHistory) {
            //接收参数
            var itemId = $stateParams.changeTypeId; //变更项目ID
            var chdrnum01 = $stateParams.chdrnum01; //保单号
            var chdrcoy = $stateParams.chdrcoy; //保单公司号码
            var searchParam = $stateParams.searchParam;
            var policyData; //保单详情
            var policy; //保单数据
            var itemData; //用于接收初始化查询initContentItem的内容，里面存在各种各样的内容，比如item038
            var initFlag = false; //检测标志，在初始化函数完成后，会被置为true
            //参数绑定
            $scope.chdrnum01 = $stateParams.chdrnum01;
            $scope.readFlag = false; //阅读协议标志，默认为false
            $scope.beneClntNum = "";
            $scope.beneClntNumS = "";
            $scope.beneClntNumA = "";
            $scope.banks = ""; //银行列表
            $scope.cityList = ""; //城市列表
            var token = sessionStorage.getItem("token");
            /**********************************************************初始化部分begin****************************************************/

            //初始化查询变更项内容
            $scope.load = function() {
                myFactory.loadingShow();
                var timestamp = myFactory.getTimetamp();
                var sfis = "itemId-token-timestamp";
                var signStr = "itemId=" + itemId + "&token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                var sign = myFactory.hex(signStr);
                $http({
                    method: 'GET',
                    url: app.domain + 'input/initContentItem.action',
                    params: { 'itemId': itemId, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                }).then(function successCallback(response) {
                    if (response.data.success) {
                        itemData = response.data.data.modelMap;
                        policy = response.data.data.policy;
                        $scope.item39 = itemData.item39;
                        $scope.banks = itemData.banks;
                        $scope.initCity = itemData.citylist;

                        var beneList = [];
                        if ($scope.item39 != null || $scope.item39 != undefined || $scope.item39 != "") {
                            beneList = $scope.item39.beneList;
                        }

                        //填充页面隐藏元素
                        if (beneList.length != 0) {
                            $scope.beneClntNum = beneList[0].clientNo;
                        }
                        for (var i = 0; i < beneList.length; i++) {
                            if (beneList[i].benfType == 'S') {
                                $scope.beneClntNumS = beneList[i].clientNo;
                            }
                            if (beneList[i].benfType == 'A') {
                                $scope.beneClntNumA = beneList[i].clientNo;
                            }
                        }


                        //初始化接受银行
                        //客户现在不想要一开始初始带出了，取消 BY ZZQ 2018-2-27
                        /*$("#recevieBankInput").val($scope.banks[0].bankdesc);
                        $scope.recevieBankSelect = $scope.banks[0].bankcode;
                        $("#recevieBankSelect").val($scope.banks[0].bankcode);*/

                        //初始化默认城市
                        //客户现在不想要一开始初始带出了，取消 BY ZZQ 2018-2-27
                        /*$("#bankCityCode").val($scope.initCity[0].citycode.trim());//设置默认城市代码
                        $("#bankCityName").val($scope.initCity[0].citydesc.trim());//设置默认城市名称*/

                        initFlag = true; //标识初始化成功
                    }
                    myFactory.loadingHide();
                }, function errorCallback(response) {
                    myFactory.loadingHide();
                    myFactory.alert("", "初始化查询变更项内容失败!", "info");
                });
            }


            /**********************************************************初始化部分end******************************************************/
            //重新受理
            $scope.renew = function() {
                    myFactory.renew();
                }
                //退出移动保全
            $scope.exit = function() {
                    myFactory.exit();
                }
                //返回函数
            $scope.goBack = function() {
                    myFactory.goBack();
                }
                //页面同意阅读协议复选框部分
            $scope.changeReadFlag = function() {
                    $scope.readFlag = !$scope.readFlag;
                }
                //保单详情弹窗
            $scope.showPolicyDetail = function() {
                    modal('open', 'policyModalOn39Input', 'overwindowOn39Input', 'policyCloseXOn39Input');
                    var timestamp = myFactory.getTimetamp();
                    var sfis = "chdrnum-chdrcoy-token-timestamp";
                    var signStr = "chdrnum=" + chdrnum01 + "&chdrcoy=" + chdrcoy + "&token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                    var sign = myFactory.hex(signStr);
                    //初始化时候查询保单详情
                    $http({
                        method: 'GET',
                        url: app.domain + 'query/restFindPolicyDetail.action',
                        params: { 'chdrnum': chdrnum01, 'chdrcoy': chdrcoy, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                    }).then(function successCallback(response) {
                        if (response.data.success) {
                            policyData = response.data.data;
                            $scope.policyData = policyData;
                            $scope.policyData.ptdate01 = myFactory.DateTools($scope.policyData.ptdate01);
                        }
                    }, function errorCallback(response) {
                        myFactory.alert("", "初始化查询订单详情失败!", "info");
                    });
                }
                //保单详情弹窗关闭函数
            $scope.policyCancelOn39Input = function() {
                    modal('close', 'policyModalOn39Input', 'overwindowOn39Input', 'policyCloseXOn39Input');
                }
                //关闭遮罩
            $scope.overwindowClose = function() {
                    //$(".overwindow").show();
                    $(".overwindow").hide();
                    $(".overmodal").hide();
                }
                //客户须知弹框
            $scope.tipOpen = function() {
                modal('open', 'tip_model', 'overwindowOn39Input');
            }
            $scope.closeTip = function() {
                    modal('close', 'tip_model', 'overwindowOn39Input');
                }
                //生存给付详情弹框
            $scope.beneDetailModal = function(index) {
                $("#beneClntDialog").fadeToggle(50);

                //能点详情弹框触发这个函数说明已经有数据，不需要对数据进行判断，这里为具体读出数组第index个
                $scope.beneDetail = $scope.item39.beneList[index];

                $("#beneClntDialog .myDialog_content .btn_close").click(function() {
                    $(this).parents('#beneClntDialog').fadeOut(50);
                });

                $("#beneClntDialog .myDialog_black").click(function() {
                    $(this).parent('#beneClntDialog').fadeOut(50);
                });
            }


            //城市弹框			
            $scope.cityChose = function() {
                modal('open', 'city_model', 'overwindowOn39Input');
            }
            $scope.cityClose = function() {
                modal('close', 'city_model', 'overwindowOn39Input');
            }

            //只输入整数函授
            $scope.keyNumPress = function() {
                var keyCode = event.keyCode;
                if (keyCode >= 48 && keyCode <= 57) {
                    event.returnValue = true;
                } else {
                    event.returnValue = false;
                }
            }

            //查找城市方法
            $scope.searchCity = function() {
                    var cityName = $("#searchCityParam").val();
                    $scope.cityList = ""; //先做一次清空处理
                    myFactory.loadingShow(); //显示加载圈
                    $timeout(function() { myFactory.loadingHide(); }, 2000);
                    var timestamp = myFactory.getTimetamp();
                    var sfis = "cityName-token-timestamp";
                    var signStr = "cityName=" + encodeURI(cityName) + "&token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                    var sign = myFactory.hex(signStr);
                    $http({
                        method: 'GET',
                        url: app.domain + 'common/restSearchCity.action',
                        params: { 'cityName': cityName, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                    }).then(function successCallback(response) {
                        if (response.data.success) {
                            $scope.cityList = response.data.data;
                        }
                    }, function errorCallback(response) {
                        myFactory.alert("", "查询城市失败!", "info");
                    });
                }
                //城市选择
            $scope.cityClick = function(cityCode, cityName) {
                    $("#bankCityName").val(cityName.trim());
                    $("#bankCityCode").val(cityCode.trim());
                }
                //银行选择
            $scope.bankChose = function() {
                    var a = $("#recevieBankSelect option:selected").val();
                    var b = $("#recevieBankSelect option:selected").text();
                    //				console.log(a);
                    //				console.log(b);
                    $("#recevieBankInput").val(b);
                }
                //S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by csf 20190527 start
                //改变投保人和被保人关系的下拉框
            $scope.changePeoRelation = function() {
                    var options = $('#peopleRelationCause option:selected');
                    $('#peopleRelationInput').val(options.text());
                }
                //S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by csf 20190527 end

            /**
             * 扫描银行卡信息
             */
            $scope.scanBankCardInfoItem39 = function() {
                    //移动端
                    cordova.sino.getBankCardInfo(function(result) {
                        if (result.success) {
                            if (!result.data.exit) {
                                if (appVersion === "IOS") {
                                    if (result.data.ok) {
                                        var cardNumber = result.data.CardNumber; //卡号
                                        var cardInsName = result.data.CardInsName; //领取银行
                                        var bankCardType = result.data.BankCardType; //银行卡类型
                                        //alert(CardNumber+","+CardInsName+","+BankCardType);
                                        //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                        if (bankCardType.indexOf('贷') >= 0) {
                                            myFactory.alert("", "信用卡账户不允许授权，请选择储蓄卡", "info");
                                            return;
                                        }
                                        //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                        cardNumber = cardNumber.replace(/ /g, "");
                                        //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                        $scope.bankCardNum = cardNumber;
                                        $scope.bigPic = result.data.bigPic;
                                        //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                        $("#accountNum").val(cardNumber);
                                        //自动填充开户银行
                                        //<option value="{{bank.bankcode}}" ng-repeat="bank in banks track by $index">{{bank.bankdesc}}</option>
                                        var flag = false;
                                        for (var i = 0; i < $scope.banks.length; i++) {
                                            if ($scope.banks[i].bankdesc.indexOf(cardInsName) >= 0) {
                                                $scope.recevieBankSelect = $scope.banks[i].bankcode;
                                                $("#recevieBankSelect").val($scope.banks[i].bankcode);
                                                $("#recevieBankInput").val($scope.banks[i].bankdesc);
                                                flag = true;
                                            }
                                        }
                                        if (!flag) {
                                            //没有扫描识别到银行名称，则通过配置名称进行匹配
                                            var bankName = myFactory.bankNameMatching(cardInsName);
                                            //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                            if ('' != bankName) {
                                                //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                                for (var i = 0; i < $scope.banks.length; i++) {
                                                    if ($scope.banks[i].bankdesc.indexOf(bankName) >= 0) {
                                                        $scope.recevieBankSelect = $scope.banks[i].bankcode;
                                                        $("#recevieBankSelect").val($scope.banks[i].bankcode);
                                                        $("#recevieBankInput").val($scope.banks[i].bankdesc);
                                                        flag = true;
                                                    }
                                                }
                                                //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                            }
                                            //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                            if (!flag) {
                                                //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                                //myFactory.alert("","部分数据已自动填入，但查找不到开户银行，请手动选择开户银行与开户城市","info");
                                                myFactory.alert("", "部分数据已自动填入，但开户银行不在可选银行列表范围", "info");
                                                //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                            } else {
                                                myFactory.alert("", "部分数据已自动填入，请手动选择开户城市", "info");
                                            }
                                        } else {
                                            myFactory.alert("", "部分数据已自动填入，请手动选择开户城市", "info");
                                        }
                                    }
                                } else {
                                    //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                    $scope.bigPic = result.data.bigPic;
                                    //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                    cordova.sino.confirmBankCardInfo(function(result) {
                                        if (result.success) {
                                            if (result.data.ok) {
                                                var cardNumber = result.data.CardNumber; //卡号
                                                var cardInsName = result.data.CardInsName; //领取银行
                                                var bankCardType = result.data.BankCardType; //银行卡类型
                                                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                                if (bankCardType.indexOf('贷') >= 0) {
                                                    myFactory.alert("", "信用卡账户不允许授权，请选择储蓄卡", "info");
                                                    return;
                                                }
                                                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                                //alert(CardNumber+","+CardInsName+","+BankCardType);
                                                cardNumber = cardNumber.replace(/ /g, "");
                                                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                                                $scope.bankCardNum = cardNumber;

                                                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                                                $("#accountNum").val(cardNumber);
                                                //自动填充开户银行
                                                //<option value="{{bank.bankcode}}" ng-repeat="bank in banks track by $index">{{bank.bankdesc}}</option>
                                                var flag = false;
                                                for (var i = 0; i < $scope.banks.length; i++) {
                                                    if ($scope.banks[i].bankdesc.indexOf(cardInsName) >= 0) {
                                                        $scope.recevieBankSelect = $scope.banks[i].bankcode;
                                                        $("#recevieBankSelect").val($scope.banks[i].bankcode);
                                                        $("#recevieBankInput").val($scope.banks[i].bankdesc);
                                                        flag = true;
                                                    }
                                                }
                                                if (!flag) {
                                                    //没有扫描识别到银行名称，则通过配置名称进行匹配
                                                    var bankName = myFactory.bankNameMatching(cardInsName);
                                                    //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                                    if ('' != bankName) {
                                                        //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                                        for (var i = 0; i < $scope.banks.length; i++) {
                                                            if ($scope.banks[i].bankdesc.indexOf(bankName) >= 0) {
                                                                $scope.recevieBankSelect = $scope.banks[i].bankcode;
                                                                $("#recevieBankSelect").val($scope.banks[i].bankcode);
                                                                $("#recevieBankInput").val($scope.banks[i].bankdesc);
                                                                flag = true;
                                                            }
                                                        }
                                                        //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                                    }
                                                    //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                                    if (!flag) {
                                                        //S2019111110714银行卡识别错误 add by yangyan 20191126 start
                                                        //myFactory.alert("","部分数据已自动填入，但查找不到开户银行，请手动选择开户银行与开户城市","info");
                                                        myFactory.alert("", "部分数据已自动填入，但开户银行不在可选银行列表范围", "info");
                                                        //S2019111110714银行卡识别错误 add by yangyan 20191126 end
                                                    } else {
                                                        myFactory.alert("", "部分数据已自动填入，请手动选择开户城市", "info");
                                                    }
                                                } else {
                                                    myFactory.alert("", "部分数据已自动填入，请手动选择开户城市", "info");
                                                }
                                            }
                                        } else {
                                            myFactory.alert('', '扫描银行卡信息失败:' + result.data.errormsg, 'info');
                                        }
                                    }, result.data)
                                }
                            }
                        } else {
                            //sino.alert("扫描银行卡信息失败:"+result.data.errormsg);
                            myFactory.alert('', '扫描银行卡信息失败:' + result.data.errormsg, 'info');
                        }
                    });

                    //PC端开发测试用
                    //				var result = {
                    //					data : {
                    //						CardNumber:"6216678911114523785",
                    //						CardInsName:"中国银行",
                    //						BankCardType:"借记卡",
                    //						ok:true
                    //					}
                    //				};
                    //				if(result.data.ok){
                    //
                    //					/*********************************待开发逻辑代码区域begin**********************************/
                    //					var cardNumber=result.data.CardNumber;//卡号
                    //					var cardInsName=result.data.CardInsName;//领取银行
                    //					var bankCardType=result.data.BankCardType;//银行卡类型
                    //					//alert(CardNumber+","+CardInsName+","+BankCardType);
                    //					cardNumber = cardNumber.replace(/ /g,"");
                    //					$("#accountNum").val(cardNumber);
                    //					//自动填充开户银行
                    //					//<option value="{{bank.bankcode}}" ng-repeat="bank in banks track by $index">{{bank.bankdesc}}</option>
                    //					var flag = false;
                    //					for(var i=0 ; i<$scope.banks.length ; i++){
                    //						if($scope.banks[i].bankdesc.indexOf(cardInsName)>=0){
                    //							$scope.recevieBankSelect = $scope.banks[i].bankcode;
                    //							$("#recevieBankSelect").val($scope.banks[i].bankcode);
                    //							$("#recevieBankInput").val($scope.banks[i].bankdesc);
                    //							flag = true;
                    //						}
                    //					}
                    //					if(!flag){
                    //						myFactory.alert("","部分数据已自动填入，但查找不到领取银行，请手动选择领取银行与开户城市","info");
                    //					}else{
                    //						myFactory.alert("","部分数据已自动填入，请手动选择开户城市","info");
                    //					}
                    //					/*********************************待开发逻辑代码区域end**********************************/
                    //				}

                } //扫描银行卡信息函数END



            //下一步
            $scope.nextStep = function() {
                myFactory.loadingShow();
                //判断是否初始化完成了，如果失败，不予进入下一步
                if (!initFlag) {
                    myFactory.alert("", "初始化时失败，请返回上一步重试", "info");
                    myFactory.loadingHide();
                    return;
                }
                //S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by csf 20190527 start
                var resonPeoRelationInput = $('#peopleRelationInput');
                if (resonPeoRelationInput.val() == '' || resonPeoRelationInput.val() == undefined) {
                    myFactory.alert("", "请选择投被保人关系", "info");
                    return;
                }

                var resonPeoRelation = $('#peopleRelationCause');
                if (resonPeoRelation.val() == '6') {
                    myFactory.alert("", "投保人与被保险人非直系亲属关系，需由被保险人的监护人提出一同申请，请通过书面办理。", "info");
                    return;
                }
                //S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by csf 20190527 end
                if ($scope.readFlag == false) {
                    myFactory.alert("", "请阅读《生存保险金/年金转账授权客户须知》！", "info");
                    myFactory.loadingHide();
                    return false;
                }

                var bankName = $("#recevieBankInput").val(); //开户银行名称
                var accountNum = $("#accountNum").val(); //银行卡号
                var bankCityCode = $('#bankCityCode').val(); //开户银行城市代码
                //var reAccountNum = $("#reAccountNum").val(); //使用扫描方式，不再需要输入第二次校验

                if (bankName == "") {
                    myFactory.alert("", "您尚未选择领取银行", "info");
                    myFactory.loadingHide();
                    return false;
                }

                if (accountNum == null || accountNum == undefined) {
                    accountNum = "";
                } else {
                    accountNum = accountNum.replace(/\s+/g, "");
                }
                if (accountNum == "") {
                    myFactory.alert("", "您尚未输入领取账号", "info");
                    myFactory.loadingHide();
                    return false;
                }
                if (accountNum != "") {
                    var str = accountNum;
                    var item;
                    var flag = false;
                    for (var i = 0; i < str.length; i++) {
                        item = str.charAt(i);
                        if (isNaN(item)) { //item为非数字
                            flag = true;
                        }
                    }
                    if (flag == true) {
                        myFactory.alert("", "领取账号请输入数字！", "info");
                        myFactory.loadingHide();
                        return false;
                    }
                }

                //				if(reAccountNum == ""){
                //					myFactory.alert("","您尚未输入重新确认领取账号","info");
                //					myFactory.loadingHide();
                //					return false;
                //				}
                //				if(accountNum != reAccountNum){
                //					myFactory.alert("","账号不一致，需重新输入!","info");
                //					myFactory.loadingHide();
                //					return false;
                //		        } 


                //				if(reAccountNum!=""){
                //		        	var item;
                //		        	var flag=false;
                //		        	for(var i=0;i<reAccountNum.length;i++){
                //		        		item=reAccountNum.charAt(i);    
                //		        		if(isNaN(item)){//item为非数字
                //		        			flag=true;
                //		        		}	
                //		        	}
                //		        	if(flag==true){
                //		        		myFactory.alert("","银行账号/卡号请输入数字！","info");
                //		        		return false;
                //		        	}
                //				}

                if (bankCityCode == "") {
                    myFactory.alert("", "您尚未选择开户城市", "info");
                    myFactory.loadingHide();
                    return false;
                }

                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 start
                var bankCardItems = {
                    bankAccNum: accountNum
                }
                if ($scope.bankCardNum == accountNum) {
                    bankCardItems['bigPic'] = $scope.bigPic;
                }
                var timestamp = myFactory.getTimetamp();
                var sfis = "token-timestamp";
                var signStr = "token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                var sign = myFactory.hex(signStr);
                $http({
                    method: 'POST',
                    url: app.domain + 'img/saveBankCardCache.action',
                    data: { paramsMap: bankCardItems, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                }).then(function successCallback(response) {
                    if (response.data.success) {
                        console.log("saveBankCardCache ok");
                    }
                }, function errorCallback(response) {
                    console.log("saveIdCardCache error");
                });

                //S2019012807164 - 信易通OCR识别功能 add by csf 20190412 end
                var ret = true;
                var _beneClntNum = ""; //	权益人（受益人）客户号码

                var beneClntNumS = $("#beneClntNumS").val(); //	受益人客户号（生存金受益人的客户号）
                var beneClntNumA = $("#beneClntNumA").val(); //	受益人客户号（  年金受益人的客户号）
                //	如果同时存在生存金、年金时程序会没有做控制处理
                //	存在生存金受益人客户时，把值作为[受益人客户号]
                if (beneClntNumS != "" && _beneClntNum == "") {
                    _beneClntNum = beneClntNumS;
                }
                //	存在年金受益人客户时，把值作为[受益人客户号]
                if (beneClntNumA != "" && _beneClntNum == "") {
                    _beneClntNum = beneClntNumA;
                }

                var _bankcode = $("#recevieBankSelect option:selected").val().trim(); //	银行代码
                var _bankacctkey = accountNum; //	银行账号
                var _city = $('#bankCityCode').val().trim(); //	银行开户城市代码
                var _paynmeFlag = "3"; //	客户类型[1-投保人,2-被保人,3-受益人]
                var _flag = "Y"; //	是否建账号[Y-是,N-否]

                //				var param = {'bankcode':_bankcode,'bankacctkey': _bankacctkey,'city':_city,'paynmeFlag':_paynmeFlag,'flag':_flag,'beneClntNum':_beneClntNum};
                //				jQuery.ajax({
                //					type:"post",
                //					url:basePath+"/charge/check.action",
                //					data:param,
                //					async:false,
                //					dataType:"JSON",
                //					success:function(data){
                //						if(data == "fail"){
                //							$("#AccountNum").testRemind("客户录入账号已被其它客户占用，请返回重新确认账号是否有误，如确认无误，请联系您的服务营销员或亲自来我司办理相关变更申请，办理时需提供你的存折卡复印件或开户证明文件，谢谢！");
                //							ret = false;
                //						}
                //					}
                //				});
                var timestamp = myFactory.getTimetamp();
                var sfis = "bankcode-bankacctkey-paynmeFlag-flag-beneClntNum-token-timestamp";
                var signStr = 'bankcode=' + _bankcode + '&bankacctkey=' + _bankacctkey + '&paynmeFlag=' + _paynmeFlag + '&flag=' + _flag + '&beneClntNum=' + _beneClntNum + "&token=" + token + "&timestamp=" + timestamp; //encodeURI(name)
                var sign = myFactory.hex(signStr);
                $http({
                    method: 'GET',
                    url: app.domain + 'charge/restCheck.action',
                    params: { 'bankcode': _bankcode, 'bankacctkey': _bankacctkey, 'city': _city, 'paynmeFlag': _paynmeFlag, 'flag': _flag, 'beneClntNum': _beneClntNum, 'sign': sign, 'sfis': sfis, 'token': token, 'timestamp': timestamp }
                }).then(function successCallback(response) {
                    if (response.data.data.message == "fail") {
                        myFactory.alert("", "客户录入账号已被其他客户占用，请重新确认账号是否有误，如确认无误，请通过书面形式办理本次申请，办理时需提供您的存折卡复印件或开户证明文件。", "info");
                        myFactory.loadingHide();
                        return false;
                    } else {
                        //校验通过，进入下一步

                        //数据封装
                        var item = {
                            "accountNum": accountNum,
                            "bankCityName": $("#bankCityName").val().trim(),
                            "bankCityCode": $("#bankCityCode").val().trim(), //额外封装属性
                            "billChnlName": "银行转账",
                            "recevieBank": $("#recevieBankSelect option:selected").val().trim(),
                            "itemId": itemId,
                            //S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by csf 20190527 start
                            'peoRelation': resonPeoRelation.val()
                                //S2019051508554《反洗钱监管-官微、移动保全增加核实投被保险关系功能需求》 add by csf 20190527 end

                        }
                        myFactory.loadingHide();

                        //CRS需求，增加个人税收页面  add by dll 2018-01-26 start
                        //非一年期险种受理"生存给付确认"时
                        //当受益人(指生存金/年金/祝寿金/满期金受益人)非投保人，且国籍为非中国籍时，系统需自动带出填写受益人（不可修改）个人税收居民身份声明
                        //备注：在移动保全系统中，受益人相当于被保人，所以直接带出被保人的个人税收居民身份证明资料
                        if (!itemData.isOneYearCrtFlag) {
                            if (policy.base != null) {
                                //条件：一年期保单，受益人非投保人，国籍非中国
                                var taxBenefitRole = itemData.taxBenefitRole; //受益人角色
                                var taxClientNo = itemData.taxClientNo; //投保人/受益人客户号
                                //CRS个人税收居民身份保全需求 增加控制填写投保人、受益人单次填写问题 add by rqyang 2018-12-08 begin
                                var benfitCrsIsexistsFlag = "";
                                var cownnum01 = policy.base.cownnum01;
                                var lifcnum01 = policy.base.lifcnum01;
                                if (cownnum01 == lifcnum01) { //投被保险人同一人
                                    benfitCrsIsexistsFlag = sessionStorage.getItem("HOLDER_CRS_ISEXISTS_FLAG");
                                } else {
                                    benfitCrsIsexistsFlag = sessionStorage.getItem("BENFIT_CRS_ISEXISTS_FLAG");
                                }
                                var nationality = "";
                                var taxName = "";
                                if ("bf" == taxBenefitRole) {
                                    nationality = policy.base.rnNationality;
                                    taxName = policy.base.rnName;
                                } else {
                                    nationality = policy.base.natlty;
                                    taxName = policy.base.surname;
                                }
                                if (nationality != "CHN" && benfitCrsIsexistsFlag == "N") { //受益人为非投保人，国籍为非中国国籍
                                    //CRS个人税收居民身份保全需求 增加控制填写投保人、受益人单次填写问题 add by rqyang 2018-12-08 end
                                    //if(policy.base.lifcnum01!=policy.base.cownnum01 && (policy.base.rnNationality!="CHN")){
                                    //&& policy.base.rnNationality!="HKG" && policy.base.rnNationality!="TWN" &&  policy.base.rnNationality!="MAC"
                                    $state.go('tax_info', {
                                        itemId: itemId,
                                        item: item,
                                        chdrnum: chdrnum01,
                                        chdrcoy: chdrcoy,
                                        taxBenefitRole: taxBenefitRole,
                                        taxClientNo: taxClientNo,
                                        taxName: taxName
                                    });
                                } else {
                                    //跳转checkMain
                                    $ionicHistory.clearCache().then(function() {
                                        $state.go('content_check_main', {
                                            itemId: itemId,
                                            item: item,
                                            chdrnum01: chdrnum01,
                                            chdrcoy: chdrcoy,
                                            searchParam: searchParam
                                        });
                                    })
                                }
                            }
                        } else {
                            //跳转checkMain
                            $ionicHistory.clearCache().then(function() {
                                $state.go('content_check_main', {
                                    itemId: itemId,
                                    item: item,
                                    chdrnum01: chdrnum01,
                                    chdrcoy: chdrcoy,
                                    searchParam: searchParam
                                });
                            })
                        }
                        //CRS需求，增加个人税收页面  add by dll 2018-01-26 end
                    }
                    myFactory.loadingHide();
                }, function errorCallback(response) {
                    myFactory.alert("", "校验信息时发生错误，请返回重试", "info");
                    myFactory.loadingHide();
                    return false;
                });
            }
        }]);
    //指针弹窗，不同APP，要提取到app.controller("content_36_inputCtrl")后面
    app.directive('infoid', function() {
        return {
            restrict: 'EA', //指明指令在DOM里面以什么形式被声明,EA.表示即可以是元素也可以是属性
            templateUrl: 'html/input/content_base_info.html' + app.clearCache,
            replace: true, //设置解析后，DOM声明的指令是否消失
            link: function(scope, element, attrs) { //链接函数负责注册DOM事件和更新DOM,
                console.log('指令完成');
            }
        }
    });
})(app)